package Day011_多线程1.ZuoYe;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author zhangyan
 * @date 2020/4/28 16:52
 */
public class Test3 {
    public static void main(String[] args) {

        MyThread1 mt1 = new MyThread1();
        mt1.start();
    }
}

class MyThread1 extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            try {
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                Date date = new Date();
                String format = sdf.format(date);
                System.out.println(format);
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}